Component({
  properties: {
    value: {
      type: String,
      value: 1
    },

    params: {
      type: null
    },

    name: {
      type: String
    },

    index: {
      type: String || Number
    }

  },

  methods: {

    /*减*/
    _subtract(e){
      let input_val = parseInt(e.currentTarget.dataset.val),
          params = e.currentTarget.dataset.params,
          index = e.currentTarget.dataset.index;

      this.triggerEvent('subtract', { input_val, params, index});
    },
    
    /*加*/
    _add(e) {
      let input_val = parseInt(e.currentTarget.dataset.val),
          params = e.currentTarget.dataset.params,
          index = e.currentTarget.dataset.index;

      this.triggerEvent('add', { input_val, params, index});
    }  
  }
});